/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dk.rofl.units;

import dk.rofl.items.Armor;
import dk.rofl.items.Weapon;
import rofl.Utils;

/**
 *
 * @author menderleit
 */
public class GoblinMonster extends Monster {

    public GoblinMonster(int level, int mobType) {
        super(level, Monster.GOBLIN, "Goblin", mobType);

        // Generate base stats.
        setBaseStamina(3);
        setBaseStrength(3);
        for (int i = 1; i < level; i++) {
            int sta = 3 - Utils.rnd().nextInt(2) + 1;
            addBaseStamina(3 + sta);
            addBaseStrength(3 + (5 - sta));
        }

        // Modify mob based on mob type.
        switch (getMobType()) {
            case Monster.TYPE_WEAK:
                if(getLevel() < 3) {
                    setBaseStamina((int)(getBaseStamina() * 0.7));
                    setBaseStrength((int)(getBaseStrength() * 0.7));
                }
                // Generate armor.
                for (int i = 0; i < Armor.armorSlots; i++) {
                    setArmorSlot(i, Armor.generateArmor(getLevel()-2, i, 0));
                }
                // Generate weapon.
                setWeapon(Weapon.generateWeapon(getLevel(), 0));
                break;
            case Monster.TYPE_NORMAL:
                if(getLevel() < 3) {
                    setBaseStamina((int)(getBaseStamina() * 0.7));
                    setBaseStrength((int)(getBaseStrength() * 0.7));
                }
                // Generate armor.
                for (int i = 0; i < Armor.armorSlots; i++) {
                    setArmorSlot(i, Armor.generateArmor(getLevel()-1, i, 1));
                }
                // Generate weapon.
                setWeapon(Weapon.generateWeapon(getLevel(), 0));
                break;
            case Monster.TYPE_STRONG:
                // Generate armor.
                for (int i = 0; i < Armor.armorSlots; i++) {
                    setArmorSlot(i, Armor.generateArmor(getLevel(), i, 2));
                }
                // Generate weapon.
                setWeapon(Weapon.generateWeapon(getLevel(), 1));
                break;
            case Monster.TYPE_ELITE:
                // Generate armor.
                for (int i = 0; i < Armor.armorSlots; i++) {
                    setArmorSlot(i, Armor.generateArmor(getLevel()-2, i, 3));
                }
                // Generate weapon.
                setWeapon(Weapon.generateWeapon(getLevel(), 2));
                break;
            case Monster.TYPE_BOSS:
                // Generate armor.
                for (int i = 0; i < Armor.armorSlots; i++) {
                    setArmorSlot(i, Armor.generateArmor(getLevel()+1, i, 4));
                }
                // Generate weapon.
                setWeapon(Weapon.generateWeapon(getLevel(), 5));
                break;
        }

        // Set current health to the maximum.
        setCurrentHealth(getMaxHealth());
    }
}
